package com.mr.util;

import org.apache.commons.lang.math.RandomUtils;

public class RandomUtil {
	public static final char[] c = "abcdefghijklmnopqrstuvwxyz".toCharArray();
	public static final char[] w = "0123456789abcdefghijklmnopqrstuvwxyz".toCharArray();
	public static final char[] n = "0123456789".toCharArray();
	public static String getRandStr(int max){
		StringBuffer sb = new StringBuffer();  
		for(int i = 0; i < max; i++) {  
			sb.append(w[RandomUtils.nextInt(w.length)]);  
		}  
		return sb.toString();  
	}
	public static String getRandChar(int max){
		StringBuffer sb = new StringBuffer();  
		for(int i = 0; i < max; i++) {  
			sb.append(c[RandomUtils.nextInt(n.length)]);  
		}  
		return sb.toString();  
	}
	public static String getRandNum(int max){
		StringBuffer sb = new StringBuffer();  
		for(int i = 0; i < max; i++) {  
			sb.append(n[RandomUtils.nextInt(n.length)]);  
		}  
		return sb.toString();  
	}
	public static void main(String[] args) {
		for(int i =0 ;i<=10;i++){
			System.out.println(getRandStr(5));
		}
		
	}
}
